package com.cdks.wuxiu.api.service.mongo;

import com.cdks.wuxiu.entity.mongodb.MoodTransInfo;

import javax.annotation.Resource;

import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;

/**
 * 心情语音转译 服务实现类
 */
@Service
public class MoodTransInfoServiceImpl implements MoodTransInfoService {
    @Resource
    private MongoTemplate mongoTemplate;


    @Override
    public MoodTransInfo getByTopicId(long topicId) {
        Query query = Query.query(Criteria.where("topicId").is(topicId));

        return mongoTemplate.findOne(query, MoodTransInfo.class);
    }


    @Override
    public int saveTransContent(MoodTransInfo transInfo) {

        mongoTemplate.insert(transInfo);

        return 0;
    }
}
